Skip to content

[C#] refactor: return AdaptiveCardInvokeResponse for ActionExecute - #673

Merged
Kuojian Lu (kuojianlu) merged 1 commit into
dotnetfluentfrom
kuojianlu/card-refactor
Oct 13, 2023
Merged

[C#] refactor: return AdaptiveCardInvokeResponse for ActionExecute#673
Kuojian Lu (kuojianlu) merged 1 commit into
dotnetfluentfrom
kuojianlu/card-refactor

Conversation

@kuojianlu

@kuojianlu Kuojian Lu (kuojianlu) commented Oct 12, 2023

Copy link
Copy Markdown
Contributor

Linked issues

closes: #601

Details

Change details

  • use AdaptiveCardInvokeResponse as return type of ActionExecuteHandler. The change is because the original style cannot meet the following requirement: return values with different types in one handler. For example, if I'd like to return Adaptive Card or text message by some cases in OnActionExecute("verb"), I have to define OnActionExecute("verb", ActionExecuteAdaptiveCardHandler) and OnActionExecute("verb", ActionExecuteTextHandler) respectively. Although the two handlers will be hit, only one result will be returned. A concrete example is SubmitAction in gptME sample.

Attestation Checklist

  • My code follows the style guidelines of this project

  • I have checked for/fixed spelling, linting, and other errors

  • I have commented my code for clarity

  • I have made corresponding changes to the documentation (we use TypeDoc to document our code)

  • My changes generate no new warnings

  • I have added tests that validates my changes, and provides sufficient test coverage. I have tested with:

    • Local testing
    • E2E testing in Teams
  • New and existing unit tests pass locally with my changes

Additional information

Feel free to add other relevant information below

}

AdaptiveCard adaptiveCard = await handler(turnContext, turnState, invokeValue.Action.Data, cancellationToken);
AdaptiveCardInvokeResponse adaptiveCardInvokeResponse = new()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better if providing something like AdaptiveCardInvokeResponseBuilder.FromCard?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but let me add it in separate PR.

@kuojianlu
Kuojian Lu (kuojianlu) merged commit be5ccca into dotnetfluent Oct 13, 2023
@kuojianlu
Kuojian Lu (kuojianlu) deleted the kuojianlu/card-refactor branch October 13, 2023 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants